From: Roger Pau Monne Date: Fri, 11 May 2012 17:59:03 +0000 (+0100) Subject: libxl: set guest_domid even if libxl__domain_make fails X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~8484 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=456639bbab924d8641dbca4468ac8998428c3e92;p=xen.git libxl: set guest_domid even if libxl__domain_make fails This is needed in order to perform the domain destruction if libxl__domain_make fails. Also move doc comment about error behaviour of libxl__domain_make from implementation to declaration. Signed-off-by: Roger Pau Monne Signed-off-by: Ian Jackson Committed-by: Ian Jackson --- diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 9ce107a689..50755379fa 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -396,8 +396,6 @@ out: int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info, uint32_t *domid) - /* on entry, libxl_domid_valid_guest(domid) must be false; - * on exit (even error exit), domid may be valid and refer to a domain */ { libxl_ctx *ctx = libxl__gc_owner(gc); int flags, ret, rc; @@ -600,6 +598,7 @@ static void initiate_domain_create(libxl__egc *egc, ret = libxl__domain_make(gc, &d_config->c_info, &domid); if (ret) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot make domain: %d", ret); + dcs->guest_domid = domid; ret = ERROR_FAIL; goto error_out; } diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index dc84881438..b1ce4d612e 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1078,9 +1078,13 @@ _hidden void libxl__exec(int stdinfd, int stdoutfd, int stderrfd, const char *arg0, char **args); // logs errors, never returns /* from xl_create */ + + /* on entry, libxl_domid_valid_guest(domid) must be false; + * on exit (even error exit), domid may be valid and refer to a domain */ _hidden int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info, uint32_t *domid); + _hidden int libxl__domain_build(libxl__gc *gc, libxl_domain_build_info *info, uint32_t domid,